/*
Label result files
*/

/*
___________________________________________________________________________
Descriptive statistics
*/

* Table 1

use "$results\02_descriptives\tab1_full_top.dta", clear
label data "Table 1, Panel A, whole numbers"
label var var "Variable"
label var all "All individuals"
label var w "Wage earners"
label var all_e "All entrepreneurs"
label var uie "Unincorporated entrepreneurs"
label var ie "Incorporated entrepreneurs"
save "$results\02_descriptives\tab1_full_top.dta", replace

use "$results\02_descriptives\tab1_full_bottom.dta", clear
label data "Table 1, Panel A, numbers with decimals"
label var var "Variable"
label var all "All individuals"
label var w "Wage earners"
label var all_e "All entrepreneurs"
label var uie "Unincorporated entrepreneurs"
label var ie "Incorporated entrepreneurs"
save "$results\02_descriptives\tab1_full_bottom.dta", replace

use "$results\02_descriptives\tab1_tmin1_top.dta", clear
label data "Table 1, Panel B, whole numbers"
label var var "Variable"
label var all "All individuals"
label var w "Wage earners"
label var all_e "All entrepreneurs"
label var uie "Unincorporated entrepreneurs"
label var ie "Incorporated entrepreneurs"
save "$results\02_descriptives\tab1_tmin1_top.dta", replace

use "$results\02_descriptives\tab1_tmin1_bottom.dta", clear
label data "Table 1, Panel B, numbers with decimals"
label var var "Variable"
label var all "All individuals"
label var w "Wage earners"
label var all_e "All entrepreneurs"
label var uie "Unincorporated entrepreneurs"
label var ie "Incorporated entrepreneurs"
save "$results\02_descriptives\tab1_tmin1_bottom.dta", replace

* Table 2

use "$results\02_descriptives\tab2.dta", clear
label data "Table 2"
label var stat "Statistic: mean / median / percentile 10 / percentile 90 / percentile 99"
label var sales_0 "Panel A, Sales"
label var empl_0 "Panel A, Number of employees"
label var stfc_0 "Panel A, Staff costs"
label var va_0 "Panel A, Value added"
label var prod_0 "Panel A, Productivity"
label var sales_10 "Panel B, Sales"
label var empl_10 "Panel B, Number of employees"
label var stfc_10 "Panel B, Staff costs"
label var va_10 "Panel B, Value added"
label var prod_10 "Panel B, Productivity"
save "$results\02_descriptives\tab2.dta", replace

* Table A1

use "$results\02_descriptives\tabA1.dta", clear
label data "Table A1"
label var qtile_own "Individual income rank (quintile)"
label var qtile_prnt "Parental income rank (quintile)"
label var firm_ind_1 "2-digit industry code of the most frequent industry"
label var shr_obs_1 "Share of observations in the most frequent industry"
label var firm_ind_2 "2-digit industry code of the second most frequent industry"
label var shr_obs_2 "Share of observations in the second most frequent industry"
save "$results\02_descriptives\tabA1.dta", replace

* Figure A1

use "$results\02_descriptives\figA1.dta", clear
label data "Figure A1"
save "$results\02_descriptives\figA1.dta", replace

* Figure A5

use "$results\02_descriptives\figA5.dta", clear
label data "Figure A5"
save "$results\02_descriptives\figA5.dta", replace

/*
___________________________________________________________________________
Selection analysis
*/

* Figure 1

use "$results\03_selection\fig1.dta", clear
label data "Figure 1"
save "$results\03_selection\fig1.dta", replace

* Figure 2

use "$results\03_selection\fig2.dta", clear
label data "Figure 2"
save "$results\03_selection\fig2.dta", replace

* Figure 3

use "$results\03_selection\fig3.dta", clear
label data "Figure 3"
save "$results\03_selection\fig3.dta", replace

* Table A2

use "$results\03_selection\tabA2.dta", clear
label data "Table A2"
save "$results\03_selection\tabA2.dta", replace

* Figure A2

use "$results\03_selection\figA2.dta", clear
label data "Figure A2"
save "$results\03_selection\figA2.dta", replace

* Figure A3

use "$results\03_selection\figA3_top.dta", clear
label data "Figure A3, Level of education"
save "$results\03_selection\figA3_top.dta", replace

use "$results\03_selection\figA3_bottom.dta", clear
label data "Figure A3, Field of education"
save "$results\03_selection\figA3_bottom.dta", replace

* Figure A4

use "$results\03_selection\figA4.dta", clear
label data "Figure A4"
save "$results\03_selection\figA4.dta", replace

* Figure A6

use "$results\03_selection\figA6.dta", clear
label data "Figure A6"
save "$results\03_selection\figA6.dta", replace

* Figure A7

use "$results\03_selection\figA7.dta", clear
label data "Figure A7"
label var rank "Parental income rank"
save "$results\03_selection\figA7.dta", replace

/*
___________________________________________________________________________
Income mobility analysis
*/

* Figure 4

use "$results\04_incomemobility\fig4.dta", clear
label data "Figure 4"
label var nro "Event timeline"
save "$results\04_incomemobility\fig4.dta", replace

* Figure 5

use "$results\04_incomemobility\fig5.dta", clear
label data "Figure 5"
label var event "Event timeline"
label var b1_ie "Individual P1-P20, Parental P1-P20: Incorporated entrepreneurs"
label var b2_ie "Individual P1-P20, Parental P21-P40: Incorporated entrepreneurs"
label var b3_ie "Individual P1-P20, Parental P41-P60: Incorporated entrepreneurs"
label var b4_ie "Individual P1-P20, Parental P61-P80: Incorporated entrepreneurs"
label var b5_ie "Individual P1-P20, Parental P81-P100: Incorporated entrepreneurs"
label var b6_ie "Individual P21-P40, Parental P1-P20: Incorporated entrepreneurs"
label var b7_ie "Individual P21-P40, Parental P21-P40: Incorporated entrepreneurs"
label var b8_ie "Individual P21-P40, Parental P41-P60: Incorporated entrepreneurs"
label var b9_ie "Individual P21-P40, Parental P61-P80: Incorporated entrepreneurs"
label var b10_ie "Individual P21-P40, Parental P81-P100: Incorporated entrepreneurs"
label var b11_ie "Individual P41-P60, Parental P1-P20: Incorporated entrepreneurs"
label var b12_ie "Individual P41-P60, Parental P21-P40: Incorporated entrepreneurs"
label var b13_ie "Individual P41-P60, Parental P41-P60: Incorporated entrepreneurs"
label var b14_ie "Individual P41-P60, Parental P61-P80: Incorporated entrepreneurs"
label var b15_ie "Individual P41-P60, Parental P81-P100: Incorporated entrepreneurs"
label var b16_ie "Individual P61-P80, Parental P1-P20: Incorporated entrepreneurs"
label var b17_ie "Individual P61-P80, Parental P21-P40: Incorporated entrepreneurs"
label var b18_ie "Individual P61-P80, Parental P41-P60: Incorporated entrepreneurs"
label var b19_ie "Individual P61-P80, Parental P61-P80: Incorporated entrepreneurs"
label var b20_ie "Individual P61-P80, Parental P81-P100: Incorporated entrepreneurs"
label var b21_ie "Individual P81-P100, Parental P1-P20: Incorporated entrepreneurs"
label var b22_ie "Individual P81-P100, Parental P21-P40: Incorporated entrepreneurs"
label var b23_ie "Individual P81-P100, Parental P41-P60: Incorporated entrepreneurs"
label var b24_ie "Individual P81-P100, Parental P61-P80: Incorporated entrepreneurs"
label var b25_ie "Individual P81-P100, Parental P81-P100: Incorporated entrepreneurs"
label var b1_we "Individual P1-P20, Parental P1-P20: Wage earners"
label var b2_we "Individual P1-P20, Parental P21-P40: Wage earners"
label var b3_we "Individual P1-P20, Parental P41-P60: Wage earners"
label var b4_we "Individual P1-P20, Parental P61-P80: Wage earners"
label var b5_we "Individual P1-P20, Parental P81-P100: Wage earners"
label var b6_we "Individual P21-P40, Parental P1-P20: Wage earners"
label var b7_we "Individual P21-P40, Parental P21-P40: Wage earners"
label var b8_we "Individual P21-P40, Parental P41-P60: Wage earners"
label var b9_we "Individual P21-P40, Parental P61-P80: Wage earners"
label var b10_we "Individual P21-P40, Parental P81-P100: Wage earners"
label var b11_we "Individual P41-P60, Parental P1-P20: Wage earners"
label var b12_we "Individual P41-P60, Parental P21-P40: Wage earners"
label var b13_we "Individual P41-P60, Parental P41-P60: Wage earners"
label var b14_we "Individual P41-P60, Parental P61-P80: Wage earners"
label var b15_we "Individual P41-P60, Parental P81-P100: Wage earners"
label var b16_we "Individual P61-P80, Parental P1-P20: Wage earners"
label var b17_we "Individual P61-P80, Parental P21-P40: Wage earners"
label var b18_we "Individual P61-P80, Parental P41-P60: Wage earners"
label var b19_we "Individual P61-P80, Parental P61-P80: Wage earners"
label var b20_we "Individual P61-P80, Parental P81-P100: Wage earners"
label var b21_we "Individual P81-P100, Parental P1-P20: Wage earners"
label var b22_we "Individual P81-P100, Parental P21-P40: Wage earners"
label var b23_we "Individual P81-P100, Parental P41-P60: Wage earners"
label var b24_we "Individual P81-P100, Parental P61-P80: Wage earners"
label var b25_we "Individual P81-P100, Parental P81-P100: Wage earners"
save "$results\04_incomemobility\fig5.dta", replace

* Figure 6

use "$results\04_incomemobility\fig6_A.dta", clear
label data "Figure 6, Panel A"
save "$results\04_incomemobility\fig6_A.dta", replace

use "$results\04_incomemobility\fig6_BC.dta", clear
label data "Figure 6, Panel B and C"
save "$results\04_incomemobility\fig6_BC.dta", replace

use "$results\04_incomemobility\fig6_DE.dta", clear
label data "Figure 6, Panel D and E"
save "$results\04_incomemobility\fig6_DE.dta", replace

* Figure A8

use "$results\04_incomemobility\figA8.dta", clear
label data "Figure A8"
label var nro "Event timeline"
save "$results\04_incomemobility\figA8.dta", replace

* Figure A9

use "$results\04_incomemobility\figA9.dta", clear
label data "Figure A9"
label var ptile "Market income percentile rank (0.1% at the top)"
label var mkti_shr_l "Wage share when retained earnings are excluded"
label var mkti_shr_ec "Share of entrepreneurial and capital income when retained earnings are excluded"
label var mkti_d_are_1_shr_l "Wage share when retained earnings are included"
label var mkti_d_are_1_shr_ec "Share of entrepreneurial and capital income when retained earnings are included"
save "$results\04_incomemobility\figA9.dta", replace

* Figure B1

use "$results\04_incomemobility\figB1.dta", clear
label data "Figure B1"
label var nro "Event timeline"
save "$results\04_incomemobility\figB1.dta", replace

* Figure B2

use "$results\04_incomemobility\figB2.dta", clear
label data "Figure B2"
label var event "Event timeline"
label var b1_ie "Individual P1-P20, Parental P1-P20: Incorporated entrepreneurs"
label var b2_ie "Individual P1-P20, Parental P21-P40: Incorporated entrepreneurs"
label var b3_ie "Individual P1-P20, Parental P41-P60: Incorporated entrepreneurs"
label var b4_ie "Individual P1-P20, Parental P61-P80: Incorporated entrepreneurs"
label var b5_ie "Individual P1-P20, Parental P81-P100: Incorporated entrepreneurs"
label var b6_ie "Individual P21-P40, Parental P1-P20: Incorporated entrepreneurs"
label var b7_ie "Individual P21-P40, Parental P21-P40: Incorporated entrepreneurs"
label var b8_ie "Individual P21-P40, Parental P41-P60: Incorporated entrepreneurs"
label var b9_ie "Individual P21-P40, Parental P61-P80: Incorporated entrepreneurs"
label var b10_ie "Individual P21-P40, Parental P81-P100: Incorporated entrepreneurs"
label var b11_ie "Individual P41-P60, Parental P1-P20: Incorporated entrepreneurs"
label var b12_ie "Individual P41-P60, Parental P21-P40: Incorporated entrepreneurs"
label var b13_ie "Individual P41-P60, Parental P41-P60: Incorporated entrepreneurs"
label var b14_ie "Individual P41-P60, Parental P61-P80: Incorporated entrepreneurs"
label var b15_ie "Individual P41-P60, Parental P81-P100: Incorporated entrepreneurs"
label var b16_ie "Individual P61-P80, Parental P1-P20: Incorporated entrepreneurs"
label var b17_ie "Individual P61-P80, Parental P21-P40: Incorporated entrepreneurs"
label var b18_ie "Individual P61-P80, Parental P41-P60: Incorporated entrepreneurs"
label var b19_ie "Individual P61-P80, Parental P61-P80: Incorporated entrepreneurs"
label var b20_ie "Individual P61-P80, Parental P81-P100: Incorporated entrepreneurs"
label var b21_ie "Individual P81-P100, Parental P1-P20: Incorporated entrepreneurs"
label var b22_ie "Individual P81-P100, Parental P21-P40: Incorporated entrepreneurs"
label var b23_ie "Individual P81-P100, Parental P41-P60: Incorporated entrepreneurs"
label var b24_ie "Individual P81-P100, Parental P61-P80: Incorporated entrepreneurs"
label var b25_ie "Individual P81-P100, Parental P81-P100: Incorporated entrepreneurs"
label var b1_we "Individual P1-P20, Parental P1-P20: Wage earners"
label var b2_we "Individual P1-P20, Parental P21-P40: Wage earners"
label var b3_we "Individual P1-P20, Parental P41-P60: Wage earners"
label var b4_we "Individual P1-P20, Parental P61-P80: Wage earners"
label var b5_we "Individual P1-P20, Parental P81-P100: Wage earners"
label var b6_we "Individual P21-P40, Parental P1-P20: Wage earners"
label var b7_we "Individual P21-P40, Parental P21-P40: Wage earners"
label var b8_we "Individual P21-P40, Parental P41-P60: Wage earners"
label var b9_we "Individual P21-P40, Parental P61-P80: Wage earners"
label var b10_we "Individual P21-P40, Parental P81-P100: Wage earners"
label var b11_we "Individual P41-P60, Parental P1-P20: Wage earners"
label var b12_we "Individual P41-P60, Parental P21-P40: Wage earners"
label var b13_we "Individual P41-P60, Parental P41-P60: Wage earners"
label var b14_we "Individual P41-P60, Parental P61-P80: Wage earners"
label var b15_we "Individual P41-P60, Parental P81-P100: Wage earners"
label var b16_we "Individual P61-P80, Parental P1-P20: Wage earners"
label var b17_we "Individual P61-P80, Parental P21-P40: Wage earners"
label var b18_we "Individual P61-P80, Parental P41-P60: Wage earners"
label var b19_we "Individual P61-P80, Parental P61-P80: Wage earners"
label var b20_we "Individual P61-P80, Parental P81-P100: Wage earners"
label var b21_we "Individual P81-P100, Parental P1-P20: Wage earners"
label var b22_we "Individual P81-P100, Parental P21-P40: Wage earners"
label var b23_we "Individual P81-P100, Parental P41-P60: Wage earners"
label var b24_we "Individual P81-P100, Parental P61-P80: Wage earners"
label var b25_we "Individual P81-P100, Parental P81-P100: Wage earners"
save "$results\04_incomemobility\figB2.dta", replace

* Figure B3

use "$results\04_incomemobility\figB3.dta", clear
label data "Figure B3"
label var event "Event timeline"
label var b1_ie "Individual P1-P20, Parental P1-P20: Incorporated entrepreneurs"
label var b2_ie "Individual P1-P20, Parental P21-P40: Incorporated entrepreneurs"
label var b3_ie "Individual P1-P20, Parental P41-P60: Incorporated entrepreneurs"
label var b4_ie "Individual P1-P20, Parental P61-P80: Incorporated entrepreneurs"
label var b5_ie "Individual P1-P20, Parental P81-P100: Incorporated entrepreneurs"
label var b6_ie "Individual P21-P40, Parental P1-P20: Incorporated entrepreneurs"
label var b7_ie "Individual P21-P40, Parental P21-P40: Incorporated entrepreneurs"
label var b8_ie "Individual P21-P40, Parental P41-P60: Incorporated entrepreneurs"
label var b9_ie "Individual P21-P40, Parental P61-P80: Incorporated entrepreneurs"
label var b10_ie "Individual P21-P40, Parental P81-P100: Incorporated entrepreneurs"
label var b11_ie "Individual P41-P60, Parental P1-P20: Incorporated entrepreneurs"
label var b12_ie "Individual P41-P60, Parental P21-P40: Incorporated entrepreneurs"
label var b13_ie "Individual P41-P60, Parental P41-P60: Incorporated entrepreneurs"
label var b14_ie "Individual P41-P60, Parental P61-P80: Incorporated entrepreneurs"
label var b15_ie "Individual P41-P60, Parental P81-P100: Incorporated entrepreneurs"
label var b16_ie "Individual P61-P80, Parental P1-P20: Incorporated entrepreneurs"
label var b17_ie "Individual P61-P80, Parental P21-P40: Incorporated entrepreneurs"
label var b18_ie "Individual P61-P80, Parental P41-P60: Incorporated entrepreneurs"
label var b19_ie "Individual P61-P80, Parental P61-P80: Incorporated entrepreneurs"
label var b20_ie "Individual P61-P80, Parental P81-P100: Incorporated entrepreneurs"
label var b21_ie "Individual P81-P100, Parental P1-P20: Incorporated entrepreneurs"
label var b22_ie "Individual P81-P100, Parental P21-P40: Incorporated entrepreneurs"
label var b23_ie "Individual P81-P100, Parental P41-P60: Incorporated entrepreneurs"
label var b24_ie "Individual P81-P100, Parental P61-P80: Incorporated entrepreneurs"
label var b25_ie "Individual P81-P100, Parental P81-P100: Incorporated entrepreneurs"
label var b1_we "Individual P1-P20, Parental P1-P20: Wage earners"
label var b2_we "Individual P1-P20, Parental P21-P40: Wage earners"
label var b3_we "Individual P1-P20, Parental P41-P60: Wage earners"
label var b4_we "Individual P1-P20, Parental P61-P80: Wage earners"
label var b5_we "Individual P1-P20, Parental P81-P100: Wage earners"
label var b6_we "Individual P21-P40, Parental P1-P20: Wage earners"
label var b7_we "Individual P21-P40, Parental P21-P40: Wage earners"
label var b8_we "Individual P21-P40, Parental P41-P60: Wage earners"
label var b9_we "Individual P21-P40, Parental P61-P80: Wage earners"
label var b10_we "Individual P21-P40, Parental P81-P100: Wage earners"
label var b11_we "Individual P41-P60, Parental P1-P20: Wage earners"
label var b12_we "Individual P41-P60, Parental P21-P40: Wage earners"
label var b13_we "Individual P41-P60, Parental P41-P60: Wage earners"
label var b14_we "Individual P41-P60, Parental P61-P80: Wage earners"
label var b15_we "Individual P41-P60, Parental P81-P100: Wage earners"
label var b16_we "Individual P61-P80, Parental P1-P20: Wage earners"
label var b17_we "Individual P61-P80, Parental P21-P40: Wage earners"
label var b18_we "Individual P61-P80, Parental P41-P60: Wage earners"
label var b19_we "Individual P61-P80, Parental P61-P80: Wage earners"
label var b20_we "Individual P61-P80, Parental P81-P100: Wage earners"
label var b21_we "Individual P81-P100, Parental P1-P20: Wage earners"
label var b22_we "Individual P81-P100, Parental P21-P40: Wage earners"
label var b23_we "Individual P81-P100, Parental P41-P60: Wage earners"
label var b24_we "Individual P81-P100, Parental P61-P80: Wage earners"
label var b25_we "Individual P81-P100, Parental P81-P100: Wage earners"
save "$results\04_incomemobility\figB3.dta", replace

* Table B1

use "$results\04_incomemobility\tabB1.dta", clear
label data "Table B1"
label var sample "Estimation sample"
label var min1_dspi_c "Mean disposable income of entrepreneurs at t-1"
label var plus10_dspi_c "Mean disposable income of entrepreneurs at t+10"
label var obs_dspi_c "Number of individuals in the sample"
order sample obs_dspi_c
save "$results\04_incomemobility\tabB1.dta", replace

* Figure B4

use "$results\04_incomemobility\figB4.dta", clear
label data "Figure B4"
label var nro "Event timeline"
label var base_bal_m1p10 "Panel B, Wage earners"
label var lvl_ie_bal_m1p10 "Panel B, Incorporated entrepreneurs"
label var base_bal_ful "Panel C, Wage earners"
label var lvl_ie_bal_ful "Panel C, Incorporated entrepreneurs"
save "$results\04_incomemobility\figB4.dta", replace

* Figure B5

use "$results\04_incomemobility\figB5.dta", clear
label data "Figure B5"
order ind
label var ind "2-digit industry code"
label var raw "Log income relative to the lowest industry (20), raw data"
label var ctrl "Log income relative to the lowest industry (20), conditional on observables"
save "$results\04_incomemobility\figB5.dta", replace

/*
___________________________________________________________________________
Firm performance analysis
*/

* Figures 7, A10 and A11

use "$results\05_firmperformance\fig7_figA10_figA11.dta", clear
label data "Figures 7, A10 and A11"
label var spec "Whether survival defined as filing taxes or not going bankrupt"
label var age "Firm age"
forval i=1(1)10 {
	label var survival_newie_own`i'_peyes "Share survived by individual income among those with entrepreneurial parents"
	label var survival_newie_own`i'_peno "Share survived by individual income among those with non-entrepreneurial parents"
	label var survival_newie_prnt`i'_peyes "Share survived by parental income among those with entrepreneurial parents"
	label var survival_newie_prnt`i'_peno "Share survived by parental income among those with non-entrepreneurial parents"
}
save "$results\05_firmperformance\fig7_figA10_figA11.dta", replace

* Figure 8

use "$results\05_firmperformance\fig8.dta", clear
label data "Figure 8"
label var decile "Individual income decile rank"
save "$results\05_firmperformance\fig8.dta", replace

* Figure 9

use "$results\05_firmperformance\fig9.dta", clear
label data "Figure 9"
label var decile "Parental income decile rank"
save "$results\05_firmperformance\fig9.dta", replace

* Table A3

use "$results\05_firmperformance\tabA3.dta", clear
label data "Table A3"
save "$results\05_firmperformance\tabA3.dta", replace

* Figure A12

use "$results\05_firmperformance\figA12.dta", clear
label data "Figure A12"
label var ptile "Individual income percentile rank"
save "$results\05_firmperformance\figA12.dta", replace

* Figure A13

use "$results\05_firmperformance\figA13.dta", clear
label data "Figure A13"
label var decile "Individual income decile rank"
save "$results\05_firmperformance\figA13.dta", replace

* Figure A14

use "$results\05_firmperformance\figA14.dta", clear
label data "Figure A14"
label var decile "Parental income decile rank"
save "$results\05_firmperformance\figA14.dta", replace
